﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Customers.master" AutoEventWireup="true" CodeFile="ThongTinsuer.aspx.cs" Inherits="ThongTinsuer" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="nutbam" runat="server">
        <asp:Button ID="SuaUSERtn" runat="server" Text="Sửa Thông Tin "  CssClass="myButton" Width="160px" Height="30px" OnClick="SuaUSERtn_Click" />&nbsp;&nbsp;&nbsp;
        <asp:Button ID="doimktn" runat="server" Text="Đổi Mật Khẩu" CssClass="myButton" Width="160px" Height="30px" OnClick="doimktn_Click" />&nbsp;&nbsp;&nbsp;
        <asp:Button ID="XemLike" runat="server" Text="Xem Và Like" CssClass="myButton" Width="160px" Height="30px" OnClick="XemLike_Click" />&nbsp;&nbsp;&nbsp;
        <asp:Button ID="DatHang" runat="server" Text=" Đặt Hàng "  CssClass="myButton" Width="160px" Height="30px" OnClick="DatHang_Click" />
        </div>
    <div id="LikeXemSP" runat="server">
        <p>Sản Phẩm Đã Like</p>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource1" CssClass="spLike">
            <Columns>
               <asp:BoundField DataField="TenSP" HeaderText="Tên Sẩn Phẩm " SortExpression=" TenSP" />
                <asp:BoundField DataField="ThoiGian" HeaderText=" Thời Gian" SortExpression="ThoiGian" />
                <asp:TemplateField HeaderText="Xem Lại">
                    <ItemTemplate>
                        <a href="ChiTietSanPham.aspx?TenSP=<%# Eval("TenSP") %>"><asp:Label ID="Label3" runat="server" Text="Click" Font-Bold="false" Font-Underline="false" ForeColor="Blue" ></asp:Label></a>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Data.mdb" SelectCommand="SELECT LikeSanPham.ID, SanPham.TenSP, LikeSanPham.ThoiGian FROM (LikeSanPham INNER JOIN SanPham ON LikeSanPham.MaSP = SanPham.MaSP) WHERE (LikeSanPham.ID = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="?" QueryStringField="ID" />
            </SelectParameters>
        </asp:AccessDataSource>
        <p> Sản Phẩm Đã Xem </p>
        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource3" CssClass="spLike">
            <Columns>
                <asp:BoundField DataField="TenSP" HeaderText="Tên Sản Phẩm" SortExpression="TenSP"></asp:BoundField>
                <asp:TemplateField HeaderText="Xem Lại">
                    <ItemTemplate>
                        <a href="ChiTietSanPham.aspx?TenSP=<%# Eval("TenSP") %>">
                            <asp:Label ID="Label3" runat="server" Text="Click" Font-Bold="false" Font-Underline="false" ForeColor="Blue"></asp:Label>
                            </a>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:AccessDataSource runat="server" ID="AccessDataSource3" DataFile="~/App_Data/Data.mdb" SelectCommand="SELECT SanPham.TenSP FROM (SanPham INNER JOIN Xem ON SanPham.MaSP = Xem.MaSP) WHERE (Xem.ID = ?)">
            <SelectParameters>
                <asp:QueryStringParameter QueryStringField="ID" Name="?"></asp:QueryStringParameter>
            </SelectParameters>
        </asp:AccessDataSource>
        <br />
    </div>
    <div id="XemTT" runat="server">
        <p> Thông Tin Chi Tiết</p>
        <table class="TTUser">
            <tr>
                <td >
                    <asp:DataList ID="DataList1" runat="server" DataKeyField="ID" DataSourceID="AccessDataSource2">
                        <ItemTemplate>
                            <table>
                                <tr>
                                    <td class="td-User">ID:</td>
                                    <td>
                                        <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td-User">Email:</td>
                                    <td>
                                        <asp:Label ID="EMAILLabel" runat="server" Text='<%# Eval("EMAIL") %>' />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td-User">Ngày Sinh:</td>
                                    <td>
                                        <asp:Label ID="NGAYSINHLabel" runat="server" Text='<%# Eval("NGAYSINH") %>' />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td-User">Ngày Đăng Ký:</td>
                                    <td>
                                        <asp:Label ID="NGAYDKLabel" runat="server" Text='<%# Eval("NGAYDK") %>' />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td-User">Câu Hỏi Bảo Mật:</td>
                                    <td>
                                        <asp:Label ID="CUAHOIBAOMATLabel" runat="server" Text='<%# Eval("CUAHOIBAOMAT") %>' />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td-User">Trả Lời:</td>
                                    <td>
                                        <asp:Label ID="TRALOILabel" runat="server" Text='<%# Eval("TRALOI") %>' />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td-User">Giới Tính:</td>
                                    <td>
                                        <asp:Label ID="GioiTinhLabel" runat="server" Text='<%# Eval("GioiTinh") %>' />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td-User">Tên Đầy Đủ:</td>
                                    <td>
                                        <asp:Label ID="TENFULLLabel" runat="server" Text='<%# Eval("TENFULL") %>' />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td-User">Phân Quyền:</td>
                                    <td>
                                        <asp:Label ID="PhanQuyenLabel" runat="server" Text='<%# Eval("PhanQuyen") %>' />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="td-User">CMND:</td>
                                    <td>
                                        <asp:Label ID="CMNDLabel0" runat="server" Text='<%# Eval("CMND") %>' />
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:DataList>
                    <asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/Data.mdb" SelectCommand="SELECT [ID], [EMAIL], [NGAYSINH], [NGAYDK], [CMND], [CUAHOIBAOMAT], [TRALOI], [GioiTinh], [TENFULL], [PhanQuyen] FROM [NGUOIDUNG] WHERE ([ID] = ?)">
                        <SelectParameters>
                            <asp:QueryStringParameter Name="ID" QueryStringField="ID" Type="String" />
                        </SelectParameters>
                    </asp:AccessDataSource>
                </td>
            </tr>
        </table>
    </div>
    <div id="ThayDoiTT" runat="server">
        <p>
            Đổi Thông Tin
        </p>
        <table class="TTUser">
            <tr>
                <td class="td-User">ID</td>
                <td>
                    <asp:TextBox ID="SuaID" runat="server" ReadOnly="True"></asp:TextBox>
                    <br />
                </td>
            </tr>
            <tr>
                <td class="td-User">Email</td>
                <td>
                    <asp:TextBox ID="SuaEmail" runat="server"></asp:TextBox>
                     <asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="SuaEmail" ErrorMessage="Định Dạng Sai" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                    <br />
                </td>
            </tr>
            <tr>
                <td class="td-User">Ngày Sinh </td>
                <td>
                    <asp:DropDownList ID="Ngay" runat="server">
                    </asp:DropDownList>
                    <asp:DropDownList ID="Thang" runat="server">
                    </asp:DropDownList>
                    <asp:DropDownList ID="Nam" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="td-User">Câu Hỏi Bảo Mật</td>
                <td>
                    <asp:DropDownList ID="DropDownList4" runat="server">
                        <asp:ListItem Value="1">Chọn Câu hỏi</asp:ListItem>
                        <asp:ListItem Value="Trường Học Đầu Tiên Của Bạn">Trường Học Đầu Tiên Của Bạn</asp:ListItem>
                        <asp:ListItem Value="Nhà Bạn Có Mấy Người">Nhà Bạn Có Mấy Người</asp:ListItem>
                        <asp:ListItem Value="Cô Giáo Bạn Tên Gì">Cô Giáo Bạn Tên Gì</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td class="td-User">Trả Lời</td>
                <td>
                    <asp:TextBox ID="SuaTraLoi" runat="server"></asp:TextBox>
                    <br />
                </td>
            </tr>
            <tr>
                <td class="td-User">Giới Tính </td>
                <td>
                    <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Value="Nam">Nam</asp:ListItem>
                        <asp:ListItem Value="Nữ">Nữ</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr>
                <td class="td-User">CMND </td>
                <td>
                    <asp:TextBox ID="suaCMND" runat="server"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="Chỉ Toàn là Số" ControlToValidate="suaCMND" ValidationExpression="[0-9]{9}"></asp:RegularExpressionValidator>
                    <br />
                </td>
            </tr>
            <tr>
                <td class="td-User">Tên Họ </td>
                <td>
                    <asp:TextBox ID="SuaTenFull" runat="server"></asp:TextBox>
                    <br />
                </td>
            </tr>
            <tr>
                <td class="td-User">Phân Quyền </td>
                <td>
                    <asp:DropDownList ID="PhanQuyen" runat="server">
                        <asp:ListItem Value="1">1</asp:ListItem>
                        <asp:ListItem Value="2">2</asp:ListItem>
                        <asp:ListItem Value="-1">-1</asp:ListItem>
                    </asp:DropDownList>
                    <br />
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td>
                    <asp:Button ID="ThayDoi" runat="server" CssClass="myButton"  Text="Thay Đổi" OnClick="ThayDoi_Click" />
                    <asp:Label ID="thongbao" runat="server" Text=" "></asp:Label>
                    <asp:Label ID="ThongbaoTT" runat="server" Text=" "></asp:Label>
                </td>
            </tr>
        </table>
    </div>
    <div id="divDoiMAT" runat="server">
        <p>
            Đổi Mật Khẩu
        </p>
        <table class="TTUser">
            <tr>
                <td class="td-User">ID </td>
                <td>
                    <asp:TextBox ID="DKID" runat="server" ReadOnly="True"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="td-User">Mật Khẩu </td>
                <td>
                    <asp:TextBox ID="SuaPass" runat="server" TextMode="Password"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" ControlToValidate="SuaPass" ErrorMessage="Phải Có Chữ và Số" ValidationExpression="(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{1,100})$"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td class="td-User">Nhập Lại Mật Khẩu </td>
                <td>
                    <asp:TextBox ID="IDMK" runat="server" TextMode="Password"></asp:TextBox>
                    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="SuaPass" ControlToValidate="IDMK" ErrorMessage="Không Giống Nhau"></asp:CompareValidator>
                </td>
            </tr>
            <tr>
                <td></td>
                <td>
                    <asp:Button ID="btnDOIMKtn" runat="server" CssClass="myButton"  Text="Đổi" OnClick="btnDOIMKtn_Click" />
                    <asp:Label ID="ThongBAoMKtn" runat="server" Text=" "></asp:Label>
                </td>
            </tr>
        </table>
    </div>
    <div id="DatHangThongTon" runat="server">
        <p> Thông Tin Đặt Hàng </p>
        <asp:GridView ID="GridView3" runat="server" DataSourceID="AccessDataSource4" AutoGenerateColumns="False" DataKeyNames="MaGioHang" CssClass="spLike">
            <Columns>
                <asp:BoundField DataField="MaGioHang" HeaderText="Mã Giỏ Hàng" InsertVisible="False" ReadOnly="True" SortExpression="MaGioHang" />
                <asp:BoundField DataField="NgayTao" HeaderText="Ngày Đặt " SortExpression="NgayTao" />
                <asp:BoundField DataField="DiaChiGiao" HeaderText="Địa Chỉ Giao" SortExpression="DiaChiGiao" />
                <asp:BoundField DataField="SODTGIAO" HeaderText="Số Điện Thoại" SortExpression="SODTGIAO" />
                <asp:BoundField DataField="TongThanhTien" HeaderText="Tổng Thành Tiền " SortExpression="TongThanhTien" />
                <asp:BoundField DataField="KiemTra" HeaderText="Tình Trạng" SortExpression="KiemTra" />
                 <asp:TemplateField HeaderText="Hủy và Xem ">
                    <ItemTemplate>
                        <a href="ThongTinsuer.aspx?ID=<%# Eval("ID") %>&MaGioHang=<%# Eval("MaGioHang") %>&xem=0"><asp:Label ID="Label1" runat="server" Text="Hủy"></asp:Label></a>&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="ThongTinsuer.aspx?ID=<%# Eval("ID") %>&MaGioHang=<%# Eval("MaGioHang") %>&xem=1"><asp:Label ID="Label2" runat="server" Text="Xem"></asp:Label></a>
                    </ItemTemplate>
                </asp:TemplateField>

            </Columns>
        </asp:GridView>
        <asp:AccessDataSource runat="server" ID="AccessDataSource4" DataFile="~/App_Data/Data.mdb" SelectCommand="SELECT MaGioHang, NgayTao, DiaChiGiao, SODTGIAO, TongThanhTien, KiemTra, ID FROM GioHang WHERE (ID = ?)">
            <SelectParameters>
                <asp:QueryStringParameter Name="?" QueryStringField="ID" />
            </SelectParameters>
        </asp:AccessDataSource>
        <p> Tổng Số Tiền Cho Mỗi Tình Trạng Đặt Hàng</p>
        <asp:GridView ID="GridView4" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource5" CssClass="spLike">
            <Columns>
                <asp:BoundField DataField="KiemTra" HeaderText="Tình Trạng " SortExpression="KiemTra"></asp:BoundField>
                <asp:BoundField DataField="TongTien" HeaderText=" Tổng Số Tiền " SortExpression="TongTien"></asp:BoundField>
            </Columns>
        </asp:GridView>
        <asp:AccessDataSource runat="server" ID="AccessDataSource5" DataFile="~/App_Data/Data.mdb" SelectCommand="SELECT KiemTra, SUM(TongThanhTien) AS TongTien FROM GioHang WHERE (ID = ?) GROUP BY KiemTra, ID">
            <SelectParameters>
                <asp:QueryStringParameter QueryStringField="ID" Name="?"></asp:QueryStringParameter>
            </SelectParameters>
        </asp:AccessDataSource>
    </div>
    <div id="ChiTieGioHangID" runat="server">
        <p>Chi Tiết Đơn Đặt Hàng : 
        <asp:Label ID="ChitietdonDathangLabel" runat="server" Text=" "></asp:Label></p>
        <asp:GridView ID="GridView5" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource6">

            <Columns>
                <asp:BoundField DataField="TenSP" HeaderText="Tên Sản Phẩm " SortExpression="TenSP"></asp:BoundField>
                <asp:BoundField DataField="Gia" HeaderText="Đơn Giá" SortExpression="Gia"></asp:BoundField>
                <asp:BoundField DataField="SoLuongDat" HeaderText="Số Lượng" SortExpression="SoLuongDat"></asp:BoundField>
                <asp:BoundField DataField="TongTien" HeaderText="Tổng Tiền" ReadOnly="True" SortExpression="TongTien"></asp:BoundField>
            </Columns>
        </asp:GridView>
        <asp:AccessDataSource runat="server" ID="AccessDataSource6" DataFile="~/App_Data/Data.mdb" SelectCommand="SELECT ChiTietGioHang.MaGioHang, SanPham.TenSP, SanPham.Gia, ChiTietGioHang.SoLuongDat, ChiTietGioHang.SoLuongDat * SanPham.Gia AS TongTien, GioHang.ID FROM ((ChiTietGioHang INNER JOIN GioHang ON ChiTietGioHang.MaGioHang = GioHang.MaGioHang) INNER JOIN SanPham ON ChiTietGioHang.MaSP = SanPham.MaSP) WHERE (GioHang.ID = ?) AND (ChiTietGioHang.MaGioHang = ?)">
            <SelectParameters>
                <asp:QueryStringParameter QueryStringField="ID" Name="?"></asp:QueryStringParameter>
                <asp:QueryStringParameter QueryStringField="MaGioHang" Name="?"></asp:QueryStringParameter>
            </SelectParameters>
        </asp:AccessDataSource>
        </div>
</asp:Content>

